from datetime import datetime

import requests
# userName=SHduolong"+"&time="+timestamp+"&num="+1+"&key=138db80f42014296b7d6d57ead679a").toString(CryptoJS.enc.Hex).toUpperCase();

import hashlib


def sha256_hash(string):
    hash_object = hashlib.sha256(string.encode('utf-8'))
    hex_dig = hash_object.hexdigest()
    return hex_dig



data={"userName":"SHduolong",  "time":str(int(datetime.now().timestamp() )), "num":"1","key":"138db80f42014296b7d6d57ead679a"}
data["sign"]=sha256_hash("userName="+data["userName"]+"&time="+data["time"]+"&num="+data["num"]+"&key="+data["key"])
post = requests.post("https://devapi.beidiancloud.cn/machine-cloud/api/sys/login", data=data)
print(post.text)

